package cn.tedu.charging.order.amqp;

import cn.tedu.charging.common.constant.AmqpComponentConst;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 将rabbitTemplate做一个简报包装
 */
@Component
@Slf4j
public class AmqpProducer<T> {
    @Autowired
    private RabbitTemplate rabbitTemplate;
    /**
     * 将消息发送给 延迟交换机 路由空字符串
     */
    public void sendDelay(T msg){
        rabbitTemplate.convertAndSend(AmqpComponentConst.DELAY_BILL_EX,"",msg);
        log.info("发送延迟消息成功");
    }
}
